import time
import subprocess

command = ["python", "sp3.py"]
subp = subprocess.Popen(command,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE,encoding="utf-8")
while True:
    output = subp.stdout.readline()

    if output == "" and subp.poll() is not None:
        break
    print(output)
return_code = subp.poll()
print(return_code)